using System;
using System.Drawing;
using System.Web;
using System.Collections;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;
using System.Text;

namespace Component
{
    public class Validation
    {

        /// <summary>
        /// function test null all controls textbox in Page
        /// </summary>
        /// <param name="current"> page current</param>
        /// <returns>false if object =null</returns>
        //public static string TestAllObjectNull(Page current)
        //{
        //    foreach (Control c in current.Controls)
        //    {
        //        string tam = c._Id;
        //        //string tma=((System.Web.UI.LiteralControl)c).Text;&& ((System.Web.UI.LiteralControl)c).Text== ""
        //        if (c is System.Web.UI .WebControls .TextBox )
        //        {
        //            //((System.Web.UI.LiteralControl)c).BackColor = System.Drawing.Color.Wheat;
        //            //((System.Web.UI.LiteralControl)c).Focus();
        //            return ((System.Web.UI.LiteralControl)c)._Id;
        //        }
        //        else
        //        {
        //            if (c is TextBox && ((TextBox)c).Text != "")
        //            {
        //                ((TextBox)c).BackColor = System.Drawing.Color.Wheat;
        //                c.Focus();
        //                return ((TextBox)c).Text;
        //            }
        //        }
        //    }
        //    return "";
        //}
        /// <summary>
        /// test testbox by id
        /// </summary>
        /// <param name="current">save textbox 's id</param>
        /// <returns>true if all get null</returns>
        //public static bool TestObjectsNull(Page current, ArrayList al)
        //{
        //    if (al.Count > 0)
        //    {
        //        foreach (string str in al)
        //        {
        //            foreach (Control c in current.Controls)
        //            {
        //                if (c._Id.CompareTo(str) == 0)
        //                {
        //                    if (c is TextBox && ((TextBox)c).Text != "")
        //                    {
        //                        ((TextBox)c).BackColor = System.Drawing.Color.Wheat;
        //                        c.Focus();
        //                        return false;
        //                    }
        //                    else
        //                    {
        //                        if (c is System.Web.UI.LiteralControl && ((System.Web.UI.LiteralControl)c).Text != "")
        //                        {
        //                            //((System.Web.UI.LiteralControl)c).BackColor = System.Drawing.Color.Wheat;
        //                            c.Focus();
        //                            return false;
        //                        }
        //                    }
        //                }
        //            }
        //        }
        //    }
        //    return true;
        //}
        

    }
}
